package cn.jekun.shop.app.action;

import javax.annotation.Resource;

import cn.jekun.component.base.bean.ErrorMsg;
import cn.jekun.component.base.exceptions.BusinessException;
import cn.jekun.shop.common.service.ShopTypeService1;
import net.sf.json.JSONObject;

/**
 * 商家分类
 * @author twj
 *
 */
@SuppressWarnings("serial")
public class ShopTypeAction extends AppBaseAction{
	@Resource(name = ShopTypeService1.BEAN_NAME)
	ShopTypeService1 shopTypeService;
	/**
	 * 商家分类
	 * @return
	 */
	public String showShopTypes(){
		JSONObject jsonObject = null;
		try {
			String parentId = this.request.getParameter("parentId");
			this.validateSign(parentId);//验证签名
			jsonObject = shopTypeService.showShopTypes(parentId);
		} catch (BusinessException e) {
			// TODO: handle exception
			jsonObject = JSONObject.fromObject(e.getErrorMsg());
		} catch (Exception e) {
			jsonObject = JSONObject.fromObject(new ErrorMsg(e.getMessage()));
			e.printStackTrace();
		}
		return this.writeJson(jsonObject);
	}

}
